
// ***********************************************************************
// AUTO GENERATED CLASS - Do Not Modify this file, if needed modify .tt
// ***********************************************************************
// Assembly         : InnovaApp_DomainLayer
// Author           : LJO+01
// Created          : 05/07/2013 23:07:47
// ***********************************************************************
// <copyright file="N.A." company="Copyright © Innovacall 2011">
//     Copyright (c) . All rights reserved.
// </copyright>
// <summary>
// Domain layer  
// DomainClass
// </summary>
// ***********************************************************************

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;


namespace InnovaApp.Layers.DomainLayer
{
    /// <summary>
    /// Class Structure_Page
    /// </summary>
    [Serializable]
    public partial class Structure_Page : _DomainLayer_Base
    {
        #region Primitive Properties
    	
        /// <summary>
        /// Gets or sets Id.
        /// </summary>
        /// <value>The Id.</value>
        public virtual int Id
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets FK_LayoutMenu_Translation.
        /// </summary>
        /// <value>The FK_LayoutMenu_Translation.</value>
        /// <remarks>
        /// Foregn key of Structure_Page
        /// 
        /// </remarks>
        public virtual int FK_LayoutMenu_Translation
        {
            get { return _fK_LayoutMenu_Translation; }
            set
            {
                if (_fK_LayoutMenu_Translation != value)
                {
                    if (LayoutMenu_Translation != null && LayoutMenu_Translation.Id != value)
                    {
                        LayoutMenu_Translation = null;
                    }
                    _fK_LayoutMenu_Translation = value;
                }
            }
        }
        private int _fK_LayoutMenu_Translation;
    	
        /// <summary>
        /// Gets or sets DirectURL.
        /// </summary>
        /// <value>The DirectURL.</value>
        public virtual string DirectURL
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets PageNameURLFormatted.
        /// </summary>
        /// <value>The PageNameURLFormatted.</value>
        public virtual string PageNameURLFormatted
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Title.
        /// </summary>
        /// <value>The Title.</value>
        public virtual string Title
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Description.
        /// </summary>
        /// <value>The Description.</value>
        public virtual string Description
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Keywords.
        /// </summary>
        /// <value>The Keywords.</value>
        public virtual string Keywords
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets RevisitAfter.
        /// </summary>
        /// <value>The RevisitAfter.</value>
        public virtual string RevisitAfter
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets Robots.
        /// </summary>
        /// <value>The Robots.</value>
        public virtual string Robots
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets ReadyToPublish.
        /// </summary>
        /// <value>The ReadyToPublish.</value>
        public virtual Nullable<bool> ReadyToPublish
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets IndexingCategory.
        /// </summary>
        /// <value>The IndexingCategory.</value>
        public virtual string IndexingCategory
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets IsActive.
        /// </summary>
        /// <value>The IsActive.</value>
        public virtual Nullable<bool> IsActive
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets PublicationDate.
        /// </summary>
        /// <value>The PublicationDate.</value>
        public virtual Nullable<System.DateTime> PublicationDate
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets LastBuildDate.
        /// </summary>
        /// <value>The LastBuildDate.</value>
        public virtual Nullable<System.DateTime> LastBuildDate
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets DateVersion.
        /// </summary>
        /// <value>The DateVersion.</value>
        public virtual Nullable<System.DateTime> DateVersion
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets SortIndex.
        /// </summary>
        /// <value>The SortIndex.</value>
        public virtual int SortIndex
        {
            get;
            set;
        }
    	
        /// <summary>
        /// Gets or sets rowversion.
        /// </summary>
        /// <value>The rowversion.</value>
        public virtual byte[] rowversion
        {
            get;
            set;
        }

        #endregion
        #region Navigation Properties
    
        /// <summary>
        /// Link Structure_Page to all ManagedContent
        /// </summary>
        public virtual ICollection<ManagedContent> ManagedContent
        {
            get
            {
                if (_managedContent == null)
                {
                    var newCollection = new FixupCollection<ManagedContent>();
                    newCollection.CollectionChanged += FixupManagedContent;
                    _managedContent = newCollection;
                }
                return _managedContent;
            }
            set
            {
                if (!ReferenceEquals(_managedContent, value))
                {
                    var previousValue = _managedContent as FixupCollection<ManagedContent>;
                    if (previousValue != null)
                    {
                        previousValue.CollectionChanged -= FixupManagedContent;
                    }
                    _managedContent = value;
                    var newValue = value as FixupCollection<ManagedContent>;
                    if (newValue != null)
                    {
                        newValue.CollectionChanged += FixupManagedContent;
                    }
                }
            }
        }
        private ICollection<ManagedContent> _managedContent;
        public virtual LayoutMenu_Translation LayoutMenu_Translation
        {
            get { return _layoutMenu_Translation; }
            set
            {
                if (!ReferenceEquals(_layoutMenu_Translation, value))
                {
                    var previousValue = _layoutMenu_Translation;
                    _layoutMenu_Translation = value;
                    FixupLayoutMenu_Translation(previousValue);
                }
            }
        }
        private LayoutMenu_Translation _layoutMenu_Translation;

        #endregion
        #region Association Fixup
    
        private void FixupLayoutMenu_Translation(LayoutMenu_Translation previousValue)
        {
            if (previousValue != null && previousValue.Structure_Page.Contains(this))
            {
                previousValue.Structure_Page.Remove(this);
            }
    
            if (LayoutMenu_Translation != null)
            {
                if (!LayoutMenu_Translation.Structure_Page.Contains(this))
                {
                    LayoutMenu_Translation.Structure_Page.Add(this);
                }
                if (FK_LayoutMenu_Translation != LayoutMenu_Translation.Id)
                {
                    FK_LayoutMenu_Translation = LayoutMenu_Translation.Id;
                }
            }
        }
    
        private void FixupManagedContent(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.NewItems != null)
            {
                foreach (ManagedContent item in e.NewItems)
                {
                    item.Structure_Page = this;
                }
            }
    
            if (e.OldItems != null)
            {
                foreach (ManagedContent item in e.OldItems)
                {
                    if (ReferenceEquals(item.Structure_Page, this))
                    {
                        item.Structure_Page = null;
                    }
                }
            }
        }

        #endregion
    }
}
